package com.zmn.oms.third.tmall;

import com.zmn.common.utils.number.NumberUtil;
import com.zmn.oms.third.tmall.api.TmallProductPrepey;
import org.jsoup.internal.StringUtil;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * 天猫勤鸽预付映射查询
 *
 * @author xiewenbing
 * @date 2021/08/30
 */
public class TmallPrepayMapper {

    /**
     * 产品，预付映射表
     */
    private final static Map<Integer, TmallProductPrepey> TMALL_PREPAY_MAP = new HashMap<Integer, TmallProductPrepey>(){{
        put(13053, new TmallProductPrepey(13053, "空调上门检测", "588016463774", "空调检测维修", "4302895580172", "空调上门检测服务", 30, 25));
        put(13054, new TmallProductPrepey(13054, "空调简单维修", "588016463774", "空调检测维修", "4405370299805","空调简单维修一口价",120,109));
        put(13055, new TmallProductPrepey(13055, "空调定频挂机（1-1.5P）复杂维修", "588016463774", "空调检测维修", "4405370299806" ,"定频挂机（1-1.5P）复杂维修一口价",248,225));
        put(13056, new TmallProductPrepey(13056, "空调定频挂机（2P-3P）复杂维修", "588016463774", "空调检测维修", "4239182144784" ,"定频挂机（2-3P）复杂维修一口价",298,271));
        put(13058, new TmallProductPrepey(13058, "空调变频挂机（1-1.5P）复杂维修", "588016463774", "空调检测维修", "4239182144794" ,"变频挂机（1-1.5P）复杂维修一口价",288,262));
        put(13059, new TmallProductPrepey(13059, "空调变频挂机（2P-3P）复杂维修", "588016463774", "空调检测维修", "4239182144787","变频挂机（2-3P）复杂维修一口价",488,444));
        put(13061, new TmallProductPrepey(13061, "空调定频柜机（2P-3P）复杂维修", "588016463774", "空调检测维修", "4239182144790","定频柜机（2-3P）复杂维修一口价",298,271));
        put(13063, new TmallProductPrepey(13063, "空调定频柜机（4P)复杂维修", "588016463774", "空调检测维修", "4239182144792","定频柜机（4P)复杂维修一口价",480,436));
        put(13064, new TmallProductPrepey(13064, "空调定频柜机（5P)复杂维修", "588016463774", "空调检测维修", "4239182144791","定频柜机（5P)复杂维修一口价",480,436));
        put(13065, new TmallProductPrepey(13065, "空调变频柜机（2P-3P）复杂维修", "588016463774", "空调检测维修", "4239182144786","变频柜机（2-3P）复杂维修一口价",488,444));
        put(13067, new TmallProductPrepey(13067, "空调变频柜机（4P)复杂维修", "588016463774", "空调检测维修", "4239182144788","变频柜机（4P)复杂维修一口价",688,625));
        put(13068, new TmallProductPrepey(13068, "空调变频柜机（5P)复杂维修", "588016463774", "空调检测维修", "4239182144785","变频柜机（5P)复杂维修一口价",950,864));
        put(13069, new TmallProductPrepey(13069, "风管机（1-1.5P）复杂维修", "588016463774", "空调检测维修", "4239182144782","风管机（1-1.5P）复杂维修一口价",328,298));
        put(13070, new TmallProductPrepey(13070, "风管机（2P-3P）复杂维修", "588016463774", "空调检测维修", "4239182144789","风管机（2-3P）复杂维修一口价",488,444));
        put(13072, new TmallProductPrepey(13072, "天井机(1-1.5P)复杂维修", "588016463774", "空调检测维修", "4239182144793","天井机(1-1.5P)复杂维修一口价",328,298));
        put(13073, new TmallProductPrepey(13073, "天井机（2P）复杂维修", "588016463774", "空调检测维修", "4239182144783","天井机（2-3P）复杂维修一口价",488,444));
        put(13075, new TmallProductPrepey(13075, "电视机上门检测服务", "588003499014", "电视机检测维修", "4477349759006","电视机上门检测服务",30,25 ));
        put(13076, new TmallProductPrepey(13076, "电视机简单维修", "588003499014", "电视机检测维修", "4235147333687","电视机简单维修一口价",120,109));
        put(13077, new TmallProductPrepey(13077, "电视复杂维修（≤32吋）", "588003499014", "电视机检测维修", "4235147333688","复杂维修一口价（≤32吋）",198,180));
        put(13078, new TmallProductPrepey(13078, "电视复杂维修（33-41吋）", "588003499014", "电视机检测维修", "4242746341156" ,"复杂维修一口价（33-41吋）",368,335));
        put(13079, new TmallProductPrepey(13079, "电视复杂维修（42-54吋）", "588003499014", "电视机检测维修", "4242746341157" ,"复杂维修一口价（42-54吋）",398,362));
        put(13082, new TmallProductPrepey(13082, "电视复杂维修（55-65吋", "588003499014", "电视机检测维修", "4242746341155","复杂维修一口价（55-65吋）",528,480));
        put(13084, new TmallProductPrepey(13084, "热水器基础上门检测服务", "587722533725", "热水器检测维修", "4242734493791","热水器基础上门检测服务",30,25 ));
        put(13085, new TmallProductPrepey(13085, "电/燃气/即热式热水器简单维修", "587722533725", "热水器检测维修", "4405372959634","电/燃气/即热式热水器简单维修一口价",100,91 ));
        put(13086, new TmallProductPrepey(13086, "电热水器（<60L）复杂维修", "587722533725", "热水器检测维修", "4405372959635","电热水器（<60L）复杂维修一口价",198,180));
        put(13087, new TmallProductPrepey(13087, "电热水器（60-100L）复杂维修", "587722533725", "热水器检测维修", "4242734493798","电热水器（60-100L）复杂维修一口价",218,198));
        put(13089, new TmallProductPrepey(13089, "电热水器（101-200L）复杂维修", "587722533725", "热水器检测维修", "4242734493802","电热水器（101-200L）复杂维修一口价",288,262));
        put(13090, new TmallProductPrepey(13090, "电热水器（201-300L）复杂维修", "587722533725", "热水器检测维修", "4242734493789","电热水器（201-300L）复杂维修一口价",320,291));
        put(13091, new TmallProductPrepey(13091, "电热水器（301-500L）复杂维修", "587722533725", "热水器检测维修", "4242734493794","电热水器（301-500L）复杂维修一口价",480,436));
        put(13092, new TmallProductPrepey(13092, "燃气热水器（≤8L）复杂维修", "587722533725", "热水器检测维修", "4242734493799","燃气热水器（≤8L）复杂维修一口价",230,209));
        put(13093, new TmallProductPrepey(13093, "燃气热水器（8.1-12L）复杂维修", "587722533725", "热水器检测维修", "4242734493795","燃气热水器（8.1-12L）复杂维修一口价",280,255));
        put(13094, new TmallProductPrepey(13094, "燃气热水器（12.1-16L）复杂维修", "587722533725", "热水器检测维修", "4242734493796","燃气热水器（12.1-16L）复杂维修一口价",320,291));
        put(13096, new TmallProductPrepey(13096, "燃气热水器（16.1-20L）复杂维修", "587722533725", "热水器检测维修", "4242734493792","燃气热水器（16.1-20L）复杂维修一口价",380,345));
        put(13097, new TmallProductPrepey(13097, "即热式热水器（≤4000瓦）复杂维修", "587722533725", "热水器检测维修", "4242734493784","即热式（≤4000瓦）复杂维修一口价",188,171));
        put(13098, new TmallProductPrepey(13098, "即热式热水器（4001-6000瓦）复杂维修", "587722533725", "热水器检测维修", "4242734493800","即热式（4001-6000瓦）复杂维修一口价",260,236));
        put(13099, new TmallProductPrepey(13099, "即热式热水器（6001-8000瓦）复杂维修", "587722533725", "热水器检测维修", "4242734493793","即热式（6001-8000瓦）复杂维修一口价",350,318));
        put(13100, new TmallProductPrepey(13100, "油烟机基础上门检测服务", "587505384850", "油烟机检测维修", "4477349759007","油烟机基础上门检测服务",30,25 ));
        put(13101, new TmallProductPrepey(13101, "油烟机简单维修", "587505384850", "油烟机检测维修", "4235148577155","油烟机简单维修一口价",100,91 ));
        put(13102, new TmallProductPrepey(13102, "普通油烟机复杂维修", "587505384850", "油烟机检测维修", "4235148577156","普通油烟机复杂维修一口价",248,225));
        put(13103, new TmallProductPrepey(13103, "中式油烟机（功率200W及以下）复杂维修","587505384850", "油烟机检测维修","4409986146529","中式油烟机（排风量14(m3/min)及以下）复杂维修一口价", 198, 180));
        put(13104, new TmallProductPrepey(13104, "中式油烟机（功率200W以上）复杂维修","587505384850", "油烟机检测维修","4409986146531","中式油烟机（排风量14(m3/min)以上）复杂维修一口价", 248, 225));
        put(13105, new TmallProductPrepey(13105, "欧式油烟机（排风量14(m3/min)及以下）复杂维修","587505384850" , "油烟机检测维修","4409986146527","欧式油烟机（排风量14(m3/min)及以下）复杂维修一口价", 248, 225));
        put(13106, new TmallProductPrepey(13106, "欧式油烟机（排风量14(m3/min)以上）复杂维修","587505384850" , "油烟机检测维修","4409986146528","欧式油烟机（排风量14(m3/min)以上）复杂维修一口价", 288, 262));
        put(13107, new TmallProductPrepey(13107, "集成灶油烟机复杂维修", "587505384850", "油烟机检测维修", "4409986146530","集成灶油烟机复杂维修一口价",360,327));
        put(13108, new TmallProductPrepey(13108, "洗衣机基础上门检测服务", "587722469606", "洗衣机检测维修", "4477359623102","洗衣机基础上门检测服务",30,25 ));
        put(13109, new TmallProductPrepey(13109, "洗衣机简单维修", "587722469606", "洗衣机检测维修", "4235148261508","洗衣机简单维修一口价",100,91 ));
        put(13110, new TmallProductPrepey(13110, "波轮全自动洗衣机（5kg及以下）复杂维修", "587722469606", "洗衣机检测维修", "4235148261509","波轮全自动（5kg及以下）复杂维修一口价",188,171));
        put(13111, new TmallProductPrepey(13111, "波轮全自动洗衣机（5.1kg-10kg）复杂维修", "587722469606", "洗衣机检测维修", "4413027947557","波轮全自动（5.1kg-10kg）复杂维修一口价",198,180));
        put(13112, new TmallProductPrepey(13112, "滚筒洗衣机（5kg及以下）复杂维修", "587722469606", "洗衣机检测维修", "4413027947560","滚筒（5kg及以下）复杂维修一口价",268,244));
        put(13113, new TmallProductPrepey(13113, "滚筒洗衣机（5.1kg-10kg）复杂维修", "587722469606", "洗衣机检测维修", "4413027947553","滚筒（5.1kg-10kg）复杂维修一口价",288,262));
        put(13114, new TmallProductPrepey(13114, "波轮半自动洗衣机复杂维修", "587722469606", "洗衣机检测维修", "4413027947554","波轮半自动复杂维修一口价",138,125));
        put(13115, new TmallProductPrepey(13115, "烘干一体洗衣机（5kg及以下）复杂维修", "587722469606", "洗衣机检测维修", "4413027947559","烘干一体（5kg及以下）复杂维修一口价",188,171));
        put(13116, new TmallProductPrepey(13116, "烘干一体洗衣机（5.1kg-10kg）复杂维修", "587722469606", "洗衣机检测维修", "4413027947558","烘干一体（5.1kg-10kg）复杂维修一口价",368,335));
        put(13117, new TmallProductPrepey(13117, "壁挂式洗衣机复杂维修", "587722469606", "洗衣机检测维修", "4413027947555","壁挂式复杂维修一口价",188,171));
        put(13118, new TmallProductPrepey(13118, "迷你洗衣机复杂维修", "587722469606", "洗衣机检测维修", "4413027947556","迷你洗衣机复杂维修一口价",188,171));
        put(13119, new TmallProductPrepey(13119, "冰箱基础上门检测服务", "588016415261", "冰箱检测维修", "4474107578075","冰箱基础上门检测服务",30,25 ));
        put(13120, new TmallProductPrepey(13120, "冰箱简单维修", "588016415261", "冰箱检测维修", "4404003471934","冰箱简单维修一口价",120,109));
        put(13121, new TmallProductPrepey(13121, "冰箱复杂维修（≤200L）", "588016415261", "冰箱检测维修", "4404003471935","复杂维修一口价（≤200L）",198,180));
        put(13122, new TmallProductPrepey(13122, "冰箱复杂维修（201L-300L）", "588016415261", "冰箱检测维修", "4239187576869","复杂维修一口价（201L-300L）",248,225));
        put(13123, new TmallProductPrepey(13123, "冰箱复杂维修（301L-400L）", "588016415261", "冰箱检测维修", "4239187576870","复杂维修一口价（301L-400L）",398,362));
        put(13124, new TmallProductPrepey(13124, "冰箱复杂维修（401L-500L）", "588016415261", "冰箱检测维修", "4239187576867","复杂维修一口价（401L-500L）",498,453));
        put(13125, new TmallProductPrepey(13125, "冰箱复杂维修（501L-600L）", "588016415261", "冰箱检测维修", "4239187576868" ,"复杂维修一口价（501L-600L）",598,544));
        put(10010, new TmallProductPrepey(10010, "挂机空调清洗", "579832577480", "挂壁式空调内机清洗", "4856590235019" ,"空调挂机单台（1台）",71,71));
        put(10076, new TmallProductPrepey(10076, "油烟机清洗（不拆机）", "579952754974", "油烟机清洗（免拆）", "4497438406391" ,"油烟机清洗服务",110,110));
    }};

    /**
     * 根据啄木鸟产品id来获取获取天猫产品价格描述对象
     * @param productId
     * @return
     */
    public static TmallProductPrepey getPrepayByProductId(Integer productId) {
        if (NumberUtil.isNullOrZero(productId)) {
            return null;
        }

        return TMALL_PREPAY_MAP.get(productId);
    }

    /**
     * 根据天猫商品id和sku 获取天猫产品价格描述对象
     * @param goodsId
     * @param skuId
     * @return
     */
    public static TmallProductPrepey getProductPrepeyByTmallGoods(String goodsId, String skuId) {
        if (StringUtil.isBlank(goodsId) || StringUtil.isBlank(skuId)) {
            return null;
        }

        for (TmallProductPrepey productPreypay : TMALL_PREPAY_MAP.values()) {
            if (Objects.equals(goodsId, productPreypay.getTmallGoodsId())
                    && Objects.equals(skuId, productPreypay.getTmallSkuId())) {
                return productPreypay;
            }
        }

        return null;
    }

}
